class Food:
    def __init__(self, food_id=None, food_name=None, price=None, stock=None, description=None, image_path=None, category=None):
        self.food_id = food_id
        self.food_name = food_name
        self.price = price
        self.stock = stock
        self.description = description
        self.image_path = image_path
        self.category = category
    
    def to_dict(self):
        return {
            'food_id': self.food_id,
            'food_name': self.food_name,
            'price': float(self.price) if self.price is not None else None,
            'stock': self.stock,
            'description': self.description,
            'image_path': self.image_path,
            'category': self.category
        }
    
    @classmethod
    def from_dict(cls, data):
        return cls(
            food_id=data.get('food_id'),
            food_name=data.get('food_name'),
            price=data.get('price'),
            stock=data.get('stock'),
            description=data.get('description'),
            image_path=data.get('image_path'),
            category=data.get('category')
        )